
<?php
include_once '../inc/config.inc.php';
include_once '../inc/mysqli.inc.php';
include_once '../inc/tool.inc.php';
$link=connect();
if(!isset($_GET['url'])){
    $_GET['url']='/Project_bbs/front/index.php';
}
if(is_login($link)){
    skip("{$_GET['url']}",'attention','您已经登陆，请不要重复注册！');
}
if(isset($_POST['submit'])){
  //  var_dump($_POST);exit();
$_POST=tosqlstring($link,$_POST);
$checkflag='register';
include_once 'inc/checkRegister.inc.php';
$query="insert into member(name,pw,registerTime) values('{$_POST['name']}',md5('{$_POST['pw']}'),now())";
$result=execute($link,$query);
if(mysqli_affected_rows($link)==1){
    setcookie('member[name]',$_POST['name']);
    setcookie('member[pw]',sha1(md5($_POST['pw'])));
    skip("{$_GET['url']}",'ok','注册成功！');
}else{
    skip("$_SERVER[REQUEST_URI]",'error','注册失败，请重试！ ');
}
}
$template='会员注册';
include_once 'inc/header.inc.php';
?>
        <div class="lgmain">
            <div class="wrap clear-float">
                <div class="header">欢迎注册成为本论坛会员</div>
                <form method="post">
                    <div class="clear-float">
                        <label>用户名：<input type="text" name="name" /><span>* 用户名不得为空，且长度不得超过32个字符</span></label>
                        <label>密码：<input type="password" name="pw" /><span>* 密码长度须超过6个字符</span></label>
                        <label>确认密码：<input type="password" name="confirm_pw" /><span>* 请确认你输入的密码</span></label>
                        <label>验证码：<input type="text" name="vcode" /><span>* 请输入下方验证码</span></label>
                        <img class="reg" src="/Project_bbs/img/vcode.php"/>
                    </div>
                    <input type="submit" class="reg_submit" value="确认注册" name="submit"/>
                </form>
            </div>
        </div>
<?php
include_once 'inc/footer.inc.php';
?>
